<template>
  <div class="net-playlist">
    <div class="cover">
      <img :src="src" />
      <div class="cover-bottom">
        <div class="left">
          <div class="headset"></div>
          <div class="count">{{ count }}</div>
        </div>
        <div class="play"></div>
      </div>
    </div>
    <div class="text">{{ text }}</div>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'

import playlistProps from './props'

export default defineComponent({
  props: playlistProps,
  setup(props) {
    const src = computed(() => props.src)
    const text = computed(() => props.text)
    const count = computed(() => props.count)
    return {
      src,
      text,
      count
    }
  }
})
</script>

<style scoped lang="less">
.net-playlist {
  width: 100px;
  padding: 0 5px;
  .cover {
    width: 100px;
    height: 100px;
    position: relative;
    img {
      width: 100%;
      height: 100%;
    }
    .cover-bottom {
      position: absolute;
      z-index: 3;
      display: flex;
      justify-content: space-between;
      align-items: center;
      bottom: 0;
      width: 100%;
      height: 18%;
      background: rgba(0, 0, 0, 0.3);
      .left {
        display: flex;
        justify-content: center;
        align-items: center;
        .headset {
          width: 15px;
          height: 15px;
          background: url('../../../assets/headset.png');
          background-size: cover;
        }
        .count {
          font-size: 10px;
          transform: scale(0.8);
          color: #cccccc;
        }
      }
      .play {
        width: 18px;
        height: 18px;
        background: url('../../../assets/play.png');
        background-size: cover;
      }
    }
  }
  .text {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    &:hover {
      cursor: pointer;
      text-decoration: underline;
    }
  }
}
</style>
